package com.test.kotlin03

fun letTest(){
    val result = listOf(3,2,1).first().let {
        it*it
    }
    println(result)
}

fun letTest2(){
    val first = listOf(3,2,1).first()
    val result = first * first;
    println(result)
}


fun formatGreenting(guestName:String?):String{
    return guestName?.let {
        "Welcome,$it."} ?:"What's your name?"   //匿式调用
}

fun main() {
    letTest()
    letTest2()

    println(formatGreenting(null))
    println(formatGreenting("lwb"))
}